<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
    <title>优惠券</title>
    <link rel="stylesheet" href="css/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.css">
    <link rel="stylesheet" href="css/demos.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" type="text/css" href="./js/swiper.min.css"/>
</head>
<style>
    .yhq_li {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        background: #fff;
        border-radius: 5px;
        margin: 10px;
        box-shadow: 0px 0px 3px #ddcccc;
    }

    .yhq_price {
        font-size: 24px;
        color: #ff0000;
    }

    .yhq_price span {
        font-size: 14px;
    }

    .yhq_center {
        color: #333;
        font-size: 14px;
    }

    .yhq_center .man {
        font-size: 12px;
        color: #666;
    }

    .yhq_right {
        width: 65px;
        height: 25px;
        line-height: 25px;
        color: #fff;
        text-align: center;
        background: #ff0000;
        border-radius: 5px;
        font-size: 14px;
    }

    .text_yh {
        font-size: 12px;
    }

    .yhq_left {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #ff0000;
    }

    .yhq_center p:nth-of-type(2) {
        color: #ff0000;
    }
</style>

<body ontouchstart>
<div class="topNav">
    <a href="javascript:void(0);" onclick="window.history.go(-1);"><i class="iconfont icon-zuo"></i></a>
    <p>优惠券</p>
</div>
<div class="block"></div>
<ul id="couponList">


</ul>
</body>
<script src="js/jquery-2.1.4.js"></script>
<script src="js/jquery-weui.js"></script>
<script src="js/swipe.js"></script>
<script src="js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
<script src="wxJs/utils/storage.js"></script>
<script src="wxJs/utils/contain.js"></script>
<script>

    var userId = GetQueryString("userId");
    if (!userId) {
        window.history.back(-1);
    }

    $(function () {
        selectCouponList()
    })

    function selectCouponList() {
        $.post(getWeiContextPath() + "/wx/VipUser/selectCouponList", {wxUserId: userId}, function (res) {
            console.log(res)
            var _couponList = $("#couponList").empty();
            $.each(res, function (i, obj) {
                _couponList.append(' <li class="yhq_li">\n' +
                    '            <div class="yhq_left">\n' +
                    '                <p class="yhq_price"><span>￥</span>' + obj.reduceMoney + '</p>\n' +
                    '                <p class="text_yh">优惠券</p>\n' +
                    '            </div>\n' +
                    '            <div class="yhq_center">\n' +
                    '                <p>' + obj.couponName + '</p>\n' +
                    '                <p>' + obj.startTime.substring(0, 10) + "至" + obj.endTime.substring(0, 10) + '</p>\n' +
                    '                <p class="man">满' + obj.useCondition + '元可用</p>\n' +
                    '            </div>\n' +
                    '            <div class="yhq_right" >\n' +
                    '                可使用\n' +
                    '            </div>\n' +
                    '        </li>')
            })


        })
    }
</script>
</html>